package com.tanhua.server.service;

import com.tanhua.common.utils.UserThreadLocal;
import com.tanhua.dubbo.api.UserLikeApi;
import com.tanhua.server.vo.CountsVo;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Service;

@Service
public class UserLikeService {

    @DubboReference(version = "1.0.0")
    private UserLikeApi userLikeApi;

    public Object queryCounts() {
        Long userId = UserThreadLocal.get();
        //封装CountsVo返回
        CountsVo countsVo = new CountsVo();
        countsVo.setEachLoveCount(this.userLikeApi.queryMutualLikeCount(userId));
        countsVo.setLoveCount(this.userLikeApi.queryLikeCount(userId));
        countsVo.setFanCount(this.userLikeApi.queryFanCount(userId));
        return countsVo;
    }
}
